package com.eastjet.maintenance.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 设备台帐
 *
 * @TableName ledger
 */
@TableName(value = "ledger")
@Data
public class Ledger implements Serializable {
    /**
     * 设备台账主键id
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 备件编码
     */
    private String code;

    /**
     * 备件名称
     */
    private String name;

    /**
     * 备件类型外键
     */
    private String type;

    /**
     * 规格型号
     */
    private String specification;

    /**
     * 单位
     */
    private String unit;

    /**
     * 生产厂家
     */
    private String manufacturer;

    /**
     * 品牌
     */
    private String brand;

    /**
     * 供应商
     */
    private String vendor;

    /**
     * 库存上限
     */
    private String inventoryLimit;

    /**
     * 库存下线
     */
    private String inventoryMinimum;

    /**
     * 更换周期
     */
    private String cycle;

    /**
     * 参考价
     */
    private BigDecimal indicativePrice;

    /**
     * 备注
     */
    private String remark;

    /**
     * 初始库存
     */
    private List<InitialInventory> list;

    /**
     * 创建人
     */
    private String createdBy;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date creationTime;

    /**
     * 更新人
     */
    private String updater;

    /**
     * 更新时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date updated;

    /**
     * 逻辑删除
     */
    private Integer is_delete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Ledger other = (Ledger) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode()))
                && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
                && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
                && (this.getSpecification() == null ? other.getSpecification() == null : this.getSpecification().equals(other.getSpecification()))
                && (this.getUnit() == null ? other.getUnit() == null : this.getUnit().equals(other.getUnit()))
                && (this.getManufacturer() == null ? other.getManufacturer() == null : this.getManufacturer().equals(other.getManufacturer()))
                && (this.getBrand() == null ? other.getBrand() == null : this.getBrand().equals(other.getBrand()))
                && (this.getVendor() == null ? other.getVendor() == null : this.getVendor().equals(other.getVendor()))
                && (this.getInventoryLimit() == null ? other.getInventoryLimit() == null : this.getInventoryLimit().equals(other.getInventoryLimit()))
                && (this.getInventoryMinimum() == null ? other.getInventoryMinimum() == null : this.getInventoryMinimum().equals(other.getInventoryMinimum()))
                && (this.getCycle() == null ? other.getCycle() == null : this.getCycle().equals(other.getCycle()))
                && (this.getIndicativePrice() == null ? other.getIndicativePrice() == null : this.getIndicativePrice().equals(other.getIndicativePrice()))
                && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
                && (this.getCreatedBy() == null ? other.getCreatedBy() == null : this.getCreatedBy().equals(other.getCreatedBy()))
                && (this.getCreationTime() == null ? other.getCreationTime() == null : this.getCreationTime().equals(other.getCreationTime()))
                && (this.getUpdater() == null ? other.getUpdater() == null : this.getUpdater().equals(other.getUpdater()))
                && (this.getUpdated() == null ? other.getUpdated() == null : this.getUpdated().equals(other.getUpdated()))
                && (this.getIs_delete() == null ? other.getIs_delete() == null : this.getIs_delete().equals(other.getIs_delete()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        result = prime * result + ((getSpecification() == null) ? 0 : getSpecification().hashCode());
        result = prime * result + ((getUnit() == null) ? 0 : getUnit().hashCode());
        result = prime * result + ((getManufacturer() == null) ? 0 : getManufacturer().hashCode());
        result = prime * result + ((getBrand() == null) ? 0 : getBrand().hashCode());
        result = prime * result + ((getVendor() == null) ? 0 : getVendor().hashCode());
        result = prime * result + ((getInventoryLimit() == null) ? 0 : getInventoryLimit().hashCode());
        result = prime * result + ((getInventoryMinimum() == null) ? 0 : getInventoryMinimum().hashCode());
        result = prime * result + ((getCycle() == null) ? 0 : getCycle().hashCode());
        result = prime * result + ((getIndicativePrice() == null) ? 0 : getIndicativePrice().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreatedBy() == null) ? 0 : getCreatedBy().hashCode());
        result = prime * result + ((getCreationTime() == null) ? 0 : getCreationTime().hashCode());
        result = prime * result + ((getUpdater() == null) ? 0 : getUpdater().hashCode());
        result = prime * result + ((getUpdated() == null) ? 0 : getUpdated().hashCode());
        result = prime * result + ((getIs_delete() == null) ? 0 : getIs_delete().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", code=").append(code);
        sb.append(", name=").append(name);
        sb.append(", type=").append(type);
        sb.append(", specification=").append(specification);
        sb.append(", unit=").append(unit);
        sb.append(", manufacturer=").append(manufacturer);
        sb.append(", brand=").append(brand);
        sb.append(", vendor=").append(vendor);
        sb.append(", inventoryLimit=").append(inventoryLimit);
        sb.append(", inventoryMinimum=").append(inventoryMinimum);
        sb.append(", cycle=").append(cycle);
        sb.append(", indicativePrice=").append(indicativePrice);
        sb.append(", remark=").append(remark);
        sb.append(", createdBy=").append(createdBy);
        sb.append(", creationTime=").append(creationTime);
        sb.append(", updater=").append(updater);
        sb.append(", updated=").append(updated);
        sb.append(", is_delete=").append(is_delete);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}